package com.pt.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDateTime;

@Data
@TableName("user_bonus_log")
public class UserBonusLog {
    @TableId(type = IdType.AUTO)
    private Long id;
    
    private Long userId;
    
    private Integer pointsChange;
    
    private LocalDateTime changeTime;
    
    private Integer changeType;
    
    private String description;
    
    // 变更类型常量
    public static final int TYPE_CHECKIN = 1;       // 签到
    public static final int TYPE_UPLOAD = 2;       // 发布种子
    public static final int TYPE_CONSUME = 3;      // 消费
    public static final int TYPE_REWARD = 4;       // 奖励
    public static final int TYPE_PENALTY = 5;      // 惩罚
    
    /**
     * 获取变更类型描述
     */
    public String getChangeTypeDesc() {
        switch (changeType) {
            case TYPE_CHECKIN:
                return "签到";
            case TYPE_UPLOAD:
                return "发布种子";
            case TYPE_CONSUME:
                return "消费";
            case TYPE_REWARD:
                return "奖励";
            case TYPE_PENALTY:
                return "惩罚";
            default:
                return "未知";
        }
    }
    
    // 为了兼容，添加alias方法
    public void setPoints(Integer points) {
        this.pointsChange = points;
    }
    
    public Integer getPoints() {
        return this.pointsChange;
    }
} 